package com.yanqu.road.server.cmd.activity.gashapon;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.GashaponProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.command.Command;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import io.netty.channel.ChannelHandlerContext;

/**
 * @Author : Cxp
 * @Time : 2024-10-21
 * @Description : 幸运扭蛋-公告广播
 */

@Cmd(code = GameProtocol.S_GASHAPON_NOTICE_SYNC, desc = "公告广播")
public class GashaponNoticeSyncCmd implements Command {

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage packet) throws Exception {
        GashaponProto.GashaponNoticeSyncMsg reqMsg = GashaponProto.GashaponNoticeSyncMsg.parseFrom(packet.getBytes());
        for (GamePlayer gamePlayer : GamePlayerMgr.getAllOnlinePlayer()) {
            gamePlayer.sendPacket(ClientProtocol.U_GASHAPON_NOTICE_SYNC, reqMsg.toBuilder());
        }
    }
}
